package com.software.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.software.dao.AgentDao;
import com.software.model.DrmAgentImg;
import com.software.model.DrmAgentIntroduce;
import com.software.model.DrmArticles;
import com.software.model.DrmUser;
import com.software.model.PageModel;

@Repository
public class AgentDaoImpl implements AgentDao {

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public Long queryArticlesCnt(PageModel vo){
		 return sqlSessionTemplate.selectOne("drm.info.qru_frm_info_cnt", vo);
	}
	
	@Override
	public List<DrmArticles> queryInfoList(PageModel vo){
		 return sqlSessionTemplate.selectList("drm.info.qru_frm_info", vo);
	}
	
	@Override
	public DrmArticles queryInfoDetails(DrmArticles param){
		 return sqlSessionTemplate.selectOne("drm.info.qru_frm_infoDetails", param);
	}
	
	@Override
	public int updateDrmArticlesDel(DrmArticles data){
	  return sqlSessionTemplate.update("drm.info.update_atr_del", data);
	}
	
	@Override
	public int updateDrmArticlesheader(DrmArticles data){
	  return sqlSessionTemplate.update("drm.info.update_atr_header", data);
	}
	
	@Override
	public int insertDrmArticles(DrmArticles data) {
		return sqlSessionTemplate.insert("drm.info.save_DrmArticles", data);
		
	}
	@Override
	public int updateDrmArticles(DrmArticles data){
		return sqlSessionTemplate.update("drm.info.update_atr_detail", data);
	}
	
	@Override
	public int updateDrmArticlesCnt(DrmArticles data){
		
		return sqlSessionTemplate.insert("drm.info.update_atr_clickCnt", data);
	}
	@Override
	public DrmAgentIntroduce qrueyIntroduce(DrmAgentIntroduce data){
		
		return sqlSessionTemplate.selectOne("drm.info.qruey_introduce", data);
	}
	@Override
	public int insertIntroduce(DrmAgentIntroduce data){
		
		return sqlSessionTemplate.insert("drm.info.save_introduce", data);
	}
	@Override
	public int updateIntroduce(DrmAgentIntroduce data){
		
		return sqlSessionTemplate.update("drm.info.update_introduce", data);
	}
	@Override
	public DrmUser queryAmountData(Long userId){
		return sqlSessionTemplate.selectOne("drm.info.search_user_amount", userId);
	}

	@Override
	public int insertDrmAgentImg(DrmAgentImg data) {
		return sqlSessionTemplate.insert("drm.info.save_drmAgentImg", data);
	}
	@Override
	public Long queryImgCnt(PageModel data){
		return sqlSessionTemplate.selectOne("drm.info.search_img_listCnt", data);
	}
	
	public List<DrmAgentImg> queryImgList(PageModel data){
		return sqlSessionTemplate.selectList("drm.info.search_img_list", data);
	}
	@Override
	public int updateImgDel(DrmAgentImg data){
		return sqlSessionTemplate.update("drm.info.update_img_del", data);
	}
	@Override
	public List<DrmAgentImg> query5ImgList(PageModel data){
		return sqlSessionTemplate.selectList("drm.info.search_5img_list", data);
		
	}
	@Override
	public DrmAgentImg queryImgOne(PageModel vo){
		return sqlSessionTemplate.selectOne("drm.info.search_img_one", vo);
	}
	
	@Override
	public int insertDrmAgentImgLog(DrmAgentImg data) {
		return sqlSessionTemplate.insert("drm.info.save_drmAgentImgLog", data);
	}
	@Override
	public int updateImgData(DrmAgentImg data){
		return sqlSessionTemplate.update("drm.info.update_img_data", data);
	}
	

}
